/**
 * 
 */
package bpel.types;

/**
 * @author Maurice & Topia
 * 
 */
public class BPELElement extends BPELType{
	
	private String name;
	private String type;
	private BPELComplexType subType;
	
	private boolean nillable;
	int minOccurs;
	int maxOccurs;
	
	public BPELElement(String name, String type, boolean nillable, int minOccurs, int maxOccurs) { 
		this.name = name;
		this.type = type;
		this.nillable = nillable;
		this.minOccurs = minOccurs;
		this.maxOccurs = maxOccurs;
	}
	
	public void setSubtype(BPELComplexType subtype){
		this.subType = subtype;
	}
	
	public BPELComplexType getSubType() {
		return subType;
	}
	
	public boolean hasSubtype(){
		return subType != null;
	}

	@Override
	public String toString() {
		return name + " [" + minOccurs + "..." + maxOccurs + "]" + (nillable?" nillable":"") + " {\n" + (type!=null?type:subType) + "\n}";
	}
	
	@Override
	public String getName() {
		return name;
	}
	
	@Override
	public String getTypeNodeName() {
		return "element";
	}
}
